<?php	
/**
 * Criação de url amigavel
 * @author Erick Haendel <erickhaendel@gmail.com>
 */
Class UrlHelper extends AppHelper{
	public function StrToUrl($string, $slug = '-') {
        $string = iconv("UTF-8", "ASCII//TRANSLIT", $string);
        $string = strtolower($string);
        if ($slug) {
	        $string = preg_replace('/[^a-z0-9]/i', $slug, $string);
	        $string = preg_replace('/' . $slug . '{2,}/i', $slug, $string);
	        $string = trim($string, $slug);
        }
        return $string;
 
	}
}